package com.alkalinesolutions.json.core;

/**
 * Indicates the supplied JSON text exceeded a maximum length specified with the
 * parser. Maximum lengths are normally used to prevent certain types of Denial
 * of Sevice attacks.
 * 
 * @author David Waite &lt;<a href='mailto:david@alkaline-solutions.com'>david@alkaline-solutions.com</a>&gt;
 * 
 */
public class LengthExceededException extends JSONException {
	private static final long serialVersionUID = 1L;

	private final int maxLength;

	public LengthExceededException(final int maxLength) {
		this.maxLength = maxLength;
	}

	@Override
	public String getMessage() {
		return String
				.format(
						Messages.getString("LengthExceededException.message"), new Integer(maxLength)); //$NON-NLS-1$
	}
}
